webpackJsonp([54],{

/***/ "Lc+S":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/message/detail-file.vue




//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




/* harmony default export */ var detail_file = ({
  data: function data() {
    return {
      currentData: {},
      form: {
        data_desc: '',
        data_files: []
      },
      rules: {
        data_desc: {
          type: 'string',
          required: true,
          message: '请填写资料描述'
        },
        data_files: {
          type: 'array',
          required: true,
          message: '请添加上报资料!'
        }
      },
      record: {},
      uploadFile: function uploadFile(file) {
        return commonApi["a" /* commonApi */].uploadFile(file).then(function (_ref) {
          var _name = _ref._name,
              _url = _ref._url;
          return { name: _name, url: _url };
        });
      }
    };
  },
  activated: function activated() {
    var _this = this;

    return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
      var p, _ref2, _ref3, department, data, record;

      return regenerator_default.a.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              p = [commonApi["a" /* commonApi */].dictionary('sending_department'), commonApi["a" /* commonApi */].searchById('WJ_send_files', _this.$route.query.id), commonApi["a" /* commonApi */].searchById('WJ_send_files_record', _this.$route.query.recordId)];
              _context.next = 3;
              return promise_default.a.all(p);

            case 3:
              _ref2 = _context.sent;
              _ref3 = slicedToArray_default()(_ref2, 3);
              department = _ref3[0];
              data = _ref3[1];
              record = _ref3[2];

              _this.record = record;
              data.data_files = data.data_files || [];
              _this.currentData = Object(utils["d" /* ReplaceDictionary */])(data, {
                sending_department: department
              });

            case 11:
            case 'end':
              return _context.stop();
          }
        }
      }, _callee, _this);
    }))();
  },

  methods: {
    onSign: function onSign(loaded) {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.prev = 0;
                _context2.next = 3;
                return commonApi["a" /* commonApi */].save('WJ_send_files_record', {
                  id: _this2.record.id,
                  state: 1
                });

              case 3:
                _this2.record.state = 1;
                _this2.$Toast('签收成功!', 'success');
                _context2.next = 10;
                break;

              case 7:
                _context2.prev = 7;
                _context2.t0 = _context2['catch'](0);

                _this2.$Toast('签收失败!', 'error');

              case 10:
                loaded();

              case 11:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2, [[0, 7]]);
      }))();
    },
    onReport: function onReport(loaded) {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _context3.prev = 0;
                _context3.next = 3;
                return commonApi["a" /* commonApi */].save('WJ_send_files_record', {
                  id: _this3.record.id,
                  state: 2,
                  data_desc: _this3.form.data_desc,
                  data_files: _this3.form.data_files
                });

              case 3:
                _this3.record.state = 2;
                _this3.form = {
                  data_desc: '',
                  data_files: []
                };
                _this3.$Toast('上报成功!', 'success');
                _context3.next = 11;
                break;

              case 8:
                _context3.prev = 8;
                _context3.t0 = _context3['catch'](0);

                _this3.$Toast('上报失败!', 'error');

              case 11:
                loaded();

              case 12:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this3, [[0, 8]]);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-2f1a7f7b","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/message/detail-file.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"收发文详情","scroll":""}},[_c('yt-form',{attrs:{"model":_vm.form,"rules":_vm.rules}},[_c('yt-card',{attrs:{"title":"基本信息"}},[_c('yt-cell',{attrs:{"label":"发文部门"}},[_vm._v(_vm._s(_vm.currentData.sending_department))]),_vm._v(" "),_c('yt-cell',{attrs:{"label":"文号"}},[_vm._v(_vm._s(_vm.currentData.number))]),_vm._v(" "),_c('yt-cell',{attrs:{"label":"文件标题","border":"none"}},[_vm._v(_vm._s(_vm.currentData.title))])],1),_vm._v(" "),_c('yt-card',{attrs:{"title":"附件"}},[_vm._l((_vm.currentData.file),function(file,index){return _c('yt-cell-open-file',{key:index,attrs:{"title":file.name,"url":file.url}},[_vm._v("\n        "+_vm._s(file.name)+"\n      ")])}),_vm._v(" "),(!_vm.currentData.file)?_c('p',{staticClass:"card-no-data"},[_vm._v("暂无附件")]):_vm._e()],2),_vm._v(" "),_c('yt-card',{attrs:{"title":"资料描述"}},[_c('yt-textarea',{model:{value:(_vm.form.data_desc),callback:function ($$v) {_vm.$set(_vm.form, "data_desc", $$v)},expression:"form.data_desc"}})],1),_vm._v(" "),_c('yt-card',{attrs:{"title":"上报资料"}},[_c('yt-file',{attrs:{"uploadFile":_vm.uploadFile},model:{value:(_vm.form.data_files),callback:function ($$v) {_vm.$set(_vm.form, "data_files", $$v)},expression:"form.data_files"}})],1),_vm._v(" "),(_vm.record.state === 0)?_c('yt-btn',{attrs:{"slot":"btn","loading":_vm.onSign,"edge":""},slot:"btn"},[_vm._v("签收")]):_vm._e(),_vm._v(" "),(_vm.record.state === 1)?_c('yt-btn',{attrs:{"slot":"btn","loading":_vm.onReport,"edge":"","validator":""},slot:"btn"},[_vm._v("上报")]):_vm._e()],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var message_detail_file = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/message/detail-file.vue
function injectStyle (ssrContext) {
  __webpack_require__("ZDkU")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-2f1a7f7b"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  detail_file,
  message_detail_file,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_message_detail_file = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "ZDkU":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});